package com.example.newfeature.fragment

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentFactory

/**
 *
 *
 * @author: tuyrt7 on 2020/12/2.
 */
class CustomFragmentFactory(private val dependency: Dependency) : FragmentFactory() {
    override fun instantiate(classLoader: ClassLoader, className: String): Fragment {
        if (className == CustomFragment::class.java.name) {
            return CustomFragment(dependency)
        }

        if (className == NestedFragment::class.java.name) {
            return NestedFragment(dependency)
        }

        if (className == NestedNestedFragment::class.java.name) {
            return NestedNestedFragment()
        }
        return super.instantiate(classLoader, className)
    }
}
